﻿<local:KinectButtonBase x:Class="Kinect.Tests.StickyButton"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:Kinect.Tests"
             mc:Ignorable="d" 
             Margin="0,0,10,10"
             MouseEnter="Button_MouseEnter">
    <local:KinectButtonBase.Template>
        <ControlTemplate TargetType="{x:Type Button}">
            <Grid x:Name="Root" RenderTransformOrigin="0.5,0.5">
                <Grid.RenderTransform>
                    <ScaleTransform />
                </Grid.RenderTransform>
                <VisualStateManager.VisualStateGroups>
                    <VisualStateGroup x:Name="FocusStates">
                        <VisualState x:Name="Focused">
                            <Storyboard>
                                <DoubleAnimation Duration="0" To="0.9" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" Storyboard.TargetName="Root" />
                                <DoubleAnimation Duration="0" To="0.9" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" Storyboard.TargetName="Root" />
                                <ColorAnimation Duration="0" To="CornflowerBlue"  Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)" Storyboard.TargetName="ButtonBackground" />
                                <ColorAnimation Duration="0" To="CornflowerBlue"  Storyboard.TargetProperty="(Rectangle.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="ButtonBackground" />
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="Unfocused"/>
                    </VisualStateGroup>
                </VisualStateManager.VisualStateGroups>
                <Rectangle x:Name="ButtonBackground" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" />
                <ContentPresenter />
                <TextBlock Visibility="{Binding SmallText}" Text="{TemplateBinding Tag}" Style="{StaticResource ToolLabelStyle}" TextWrapping="WrapWithOverflow"  />
                <TextBlock Visibility="{Binding LargeText}" Text="{TemplateBinding Tag}" Style="{StaticResource ToolLabelStyleLarge}" TextWrapping="WrapWithOverflow"  />
            </Grid>

        </ControlTemplate>
    </local:KinectButtonBase.Template>
</local:KinectButtonBase>
